<?php

function upload2()
{

	$files = array();

	foreach ($_FILES['up']['name'] as $id => $name) {
		
		// 创建文件
		$dir = 'updata2/'.date('y/m');
		is_dir($dir) or mkdir($dir,0755,true);

		//判断是发是合法
		if($_FILES['up']['error'][$id]==0){
			if($_FILES['up']['tmp_name'][$id]){
				$info = pathinfo($_FILES['up']['name'][$id])['extension'];

				// 创建文件路径
				$exi = $dir.'/'.mt_rand().time().'.'.$info;

				// 移动文件到指定的路径中
				if(move_uploaded_file($_FILES['up']['tmp_name'][$id], $exi)){

					$files[]=array(

						'name'=>$_FILES['up']['name'][$id],
						'type'=>$_FILES['up']['type'][$id],
						'size'=>$_FILES['up']['size'][$id],
						'time'=>time(),
						'filename'=>$exi,

						);

				};


			}
		}
	}
	return $files;
}


?>